//
//  MeViewController.m
//  豆瓣YHY
//
//  Created by dllo on 15/11/1.
//  Copyright © 2015年 蓝鸥科技. All rights reserved.
//

#import "MeViewController.h"
#import "MeViewTableViewCell.h"
#import "MeLoginViewController.h"
#import "FirstlogViewController.h"
@interface MeViewController ()<UITableViewDataSource,UITableViewDelegate>
@property (nonatomic,retain)NSMutableArray *myarray;
@end

@implementation MeViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor yellowColor];
    self.tableView = [[UITableView alloc]initWithFrame:[[UIScreen mainScreen]bounds] style:UITableViewStylePlain];
    [self.view addSubview:self.tableView];
    self.tableView.delegate = self;
    self.tableView.dataSource = self;
    [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"cell"];
    self.navigationItem.title = @"我的";
    self.myarray = [NSMutableArray arrayWithObjects:@"我的活动",@"我的电影",@"清除缓存", nil];
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 1;
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    static NSString *cell1 = @"cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cell1];
  //  cell.textLabel.text = @"我的活动";
//    cell.textLabel.text = @"我的电影";
//    cell.textLabel.text = @"清除缓存";
    cell.textLabel.text = [self.myarray objectAtIndex:indexPath.section];
    return cell;
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return self.myarray.count;
}

//点击行
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    if ([self.myarray objectAtIndex:indexPath.section]) {
//        MeLoginViewController *meView = [[MeLoginViewController alloc]init];
//        UINavigationController *nacontroller = [[UINavigationController alloc]initWithRootViewController:meView];
//        meView.title = @"注册";
//        meView.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc]initWithTitle:@"注册" style:UIBarButtonItemStylePlain target:self action:@selector(rightAation:)];
//        meView.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithTitle:@"返回登入" style:UIBarButtonItemStyleDone target:self action:@selector(leftAction:)];
//        [self presentViewController:nacontroller animated:YES completion:^{
//            
//            
//        }];
        
        
        NSLog(@"zzzzzzz");
        FirstlogViewController *first = [[FirstlogViewController alloc]init];
        
     UINavigationController *na =    [[UINavigationController alloc]initWithRootViewController:first];
        first.title = @"登入";
        first.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithTitle:@"返回" style:UIBarButtonItemStylePlain target:self action:@selector(leftAction:)];
[self presentViewController:na animated:YES completion:^{
            
            
        }];
    }
}


-(void)leftAction:(UIBarButtonItem *)bar{
    
    [self dismissViewControllerAnimated:YES completion:^{
        
        
    }];
    
    
    
//    [self dismissViewControllerAnimated:YES completion:^{
//        
//        
//    }];
//
//     }- (void)rightAation:(UIBarButtonItem *)bar1{
//    NSLog(@"y");
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
